<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
  <ol id="ol">
    <li>0</li>
    <li>1</li>
    <li>2</li>
  </ol>

  <script>
    // 将字符串插入到ol前面
    ol.before('before')
    // 将字符串插入到ol后面
    ol.after('after')

    let firstLi = document.createElement('li')
    firstLi.innerHTML = 'prepend'
    // 插入ol里面的开头
    ol.prepend(firstLi)
    
    let liLast = document.createElement('li')
    liLast.innerHTML = 'append'
    // 插入ol中的末尾
    ol.append(liLast)
  </script>
</body>
</html>